const dataList=[
    {id:1,name:"John",age:25},
    {id:2,name:"Mary",age:30},
    {id:3,name:"Peter",age:20},
    {id:4,name:"David",age:35},
    {id:5,name:"Tom",age:28}
]

const findName="David";
const findIndex=dataList.findIndex(item=>item.name===findName);
console.log(findIndex);
